<button type="button" data-controller="dropdown" data-target="actions-post-<%= project.id %>" aria-label="<%= t("decidim.admin.actions.actions_label", resource: project.title) %>">
  <%= icon "more-fill", class: "text-secondary" %>
</button>

<div class="inline-block relative">
  <ul id="actions-post-<%= project.id %>" class="dropdown dropdown__action" aria-hidden="true">
    <% if view == :deleted %>
      <% if allowed_to? :restore, :project, trashable_deleted_resource: project %>
        <li class="dropdown__item">
          <%= link_to restore_budget_project_path(project.budget, project), method: :patch, class: "dropdown__button" do %>
            <%= icon "refresh-line" %>
            <%= t("decidim.admin.actions.restore") %>
          <% end %>
        </li>
      <% end %>
    <% else %>
      <% if allowed_to? :update, :project, project: project %>
        <li class="dropdown__item">
          <%= link_to resource_locator([budget, project]).edit, class: "dropdown__button" do %>
            <%= icon "pencil-line" %>
            <%= t("actions.edit", scope: "decidim.budgets") %>
          <% end %>
        </li>

        <hr>

        <li class="dropdown__item">
          <%= link_to project_attachment_collections_path(project), class: "dropdown__button" do %>
            <%= icon "folder-line" %>
            <%= t("actions.attachment_collections", scope: "decidim.admin") %>
          <% end %>
        </li>
        <li class="dropdown__item">
          <%= link_to project_attachments_path(project), class: "dropdown__button" do %>
            <%= icon "attachment-line" %>
            <%= t("actions.attachments", scope: "decidim.admin") %>
          <% end %>
        </li>

        <hr>
      <% end %>

      <li class="dropdown__item">
        <%= link_to resource_locator([budget, project]).path, target: :blank, data: { "external-link": false }, class: "dropdown__button" do %>
          <%= icon "eye-line" %>
          <%= t("actions.preview", scope: "decidim.budgets") %>
        <% end %>
      </li>

      <hr>

      <li class="dropdown__item">
        <% if allowed_to? :soft_delete, :project, trashable_deleted_resource: project %>
          <%= link_to soft_delete_budget_project_path(project.budget, project), method: :patch, data: { confirm: t("actions.confirm_delete_project", scope: "decidim.budgets") }, class: "dropdown__button" do %>
            <%= icon "delete-bin-line" %>
            <%= t("actions.soft_delete", scope: "decidim.admin") %>
          <% end %>
        <% else %>
          <div class="dropdown__button-disabled">
            <%= with_tooltip t("tooltips.deleted_projects_info", scope: "decidim.admin") do %>
              <%= icon "delete-bin-line", class: "text-gray" %>
              <span>
                <%= t("actions.soft_delete", scope: "decidim.admin") %>
              </span>
            <% end %>
          </div>
        <% end %>
      </li>
    <% end %>
  </ul>
</div>
